package cn.stard.feign;

import cn.stard.domian.User;
import feign.hystrix.FallbackFactory;
import lombok.extern.java.Log;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
public class UserFeignClientFallback implements FallbackFactory<UserFeignCilent> {


    @Override
    public UserFeignCilent create(Throwable throwable) {

        return new UserFeignCilent() {
            @Override
            public User getUserById(Long id) {
                throwable.printStackTrace();
                return User.builder().intro("设置类上的熔断").build();
            }
        };
    }
}
